package com.cims.action.product;

import java.util.ArrayList;
import java.util.List;

import com.cims.action.BaseAction;
import com.cims.bo.product.ProductBO;
import com.cims.bo.product.ProductBOImpl;
import com.cims.common.exception.BoException;
import com.cims.common.vo.Product;

/***
 * <strong>ProductAction</strong><br>
 * <br>
 * 
 * @author AnhDN
 * @version $Id$
 */
public class ProductAction extends BaseAction{

	/** serialVersionUID */
	private static final long	serialVersionUID	= 1L;
	private ProductBO			product				= new ProductBOImpl();
	private List<Product>		listProduct			= new ArrayList<>();
	private int					proId;
	private Product				pro					= new Product();

	/***
	 * List all product that we sell
	 * Done
	 */
	public String list(){
		try{
			listProduct = product.getListProduct();
			return SUCCESS;
		}catch(Exception e){
			return ERROR;
		}
	}

	// find product by id
	public String detail(){
		// String paramValue = request.getParameter("proId");
		// String param = getRequest().getParameter("proId");
		System.out.println(proId);
		try{
			pro = product.findByProductId(proId);
		}catch(BoException e){
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return SUCCESS;
	}

	public List<Product> getListProduct(){
		return listProduct;
	}

	public void setListProduct(List<Product> listProduct){
		this.listProduct = listProduct;
	}

	public int getProId(){
		return proId;
	}

	public void setProId(int proId){
		this.proId = proId;
	}

	public Product getPro(){
		return pro;
	}

	public void setPro(Product pro){
		this.pro = pro;
	}

}
